package com.inspur.demo.feign;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

//FallbackFactory的优点是可以获取到异常信息
@Component
public class FeignTestClient2FallbackFactory implements FallbackFactory<FeignTestClient2> {
    @Override
    public FeignTestClient2 create(Throwable throwable) {
        return new FeignTestClient2() {
            @Override
            public String get(String id) {
                return "get trigger hystrix open! reason: " + throwable.getMessage();
            }
        };
    }
}
